package com.woniuxy.house.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.entity.house.Building;
import com.woniuxy.entity.house.dto.BuildingDto;
import com.woniuxy.entity.house.dto.BuildingInfoDto;
import com.woniuxy.entity.house.dto.SelectBuildingDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liangyu
 * @since 2021-03-19
 */
@Mapper
public interface BuildingMapper extends BaseMapper<Building> {
    //根据经纬度查询楼盘id
    int findBidByMap(@Param("longitude") BigDecimal longitude, @Param("latitude") BigDecimal latitude);
    //根据楼盘id查询户型然后查询其租房、二手房
    BuildingDto findDtoByBid(int bid);

    //修改在售房屋数量
    int updateSaleNum(@Param("id") int id,@Param("num") int num);
    //修改楼盘均价
    int updateAvg(@Param("id") int id, @Param("price") BigDecimal price);
    //查询所有楼盘展示信息
    List<BuildingInfoDto> findAllBuilding(Page<BuildingInfoDto> page);
    //条件查询楼盘信息
    List<BuildingInfoDto> findByConditions(Page page,@Param("selectBuildingDto") SelectBuildingDto selectBuildingDto);

}
